<?php
/**
 * Created by PhpStorm.
 * User: wx:wenyi2048
 * Date: 2022/3/29 0029
 * Time: 10:48
 */

namespace app\api\controller;

use app\common\service\TypeService;


class Types
{
    /**
     * 分类树
     */
    public function tree(){
        $tService = new TypeService();
        $result = $tService->treeList();
        return apiSuccess($result);
    }

    /**
     * 指定二级搜索
     */
    public function search(){
        if(!input('id')) apiError('指定父级分类id');
        $tService = new TypeService();
        $result = $tService->getNodeSearch(input('id'),input('name'));
        return apiSuccess($result);
    }
}